package se.thoka.twt.client.widgets;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasEnabled;
import com.google.gwt.user.client.ui.HasText;

public class TWTButton extends Composite implements HasText, HasEnabled, HasClickHandlers {
	
	private static final String STYLE = "twt-Button";

	private Button button;
	
	public TWTButton() {
		this(null);
	}
	
	public TWTButton(String text) {
		button = new Button(text);
		initWidget(button);
		
		addStyleName(STYLE);
	}
	
	@Override
	public HandlerRegistration addClickHandler(ClickHandler handler) {
		return button.addClickHandler(handler);
	}
	
	@Override
	public String getText() {
		return button.getText();
	}
	
	@Override
	public boolean isEnabled() {
		return button.isEnabled();
	}
	
	@Override
	public void setEnabled(boolean enabled) {
		button.setEnabled(enabled);
	}
	
	@Override
	public void setText(String text) {
		button.setText(text);
	}
}
